package org.yellowmug.ubible;

import java.io.IOException;
import java.io.InputStream;

import android.os.Bundle;
import android.app.Activity;
import android.content.res.AssetManager;
import android.widget.TextView;

public class uBible extends Activity {

	TextView tv1;
	
	private String bibleVersion = "ceb";
	private String bibleBook    = "01O";
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ubible);

        tv1 = (TextView)findViewById(R.id.tv1);

		loadChapter();
    }

    private void loadChapter() {
        
        AssetManager am = this.getAssets();
        
        try {
	        InputStream is = am.open("bible_data/" + getBibleVersion() + "/" + getBibleBook() + "/1");
	        byte[] b       = new byte[is.available()];
	        
	        is.read(b);
	        tv1.setText(new String(b));
        } catch (IOException e) {
        	e.printStackTrace();
        }
    }

	public String getBibleVersion() {
		return bibleVersion;
	}

	public void setBibleVersion(String bibleVersion) {
		this.bibleVersion = bibleVersion;
	}

	public String getBibleBook() {
		return bibleBook;
	}

	public void setBibleBook(String bibleBook) {
		this.bibleBook = bibleBook;
	}
}
